Microcontrollers typically include a processor and one or more types of memories, e.g., volatile and non-volatile memories (NVM). For example, a microcontroller can have both a Static Random Access Memory (SRAM) device and a flash memory device. The processor can access the SRAM more quickly than the flash memory, but because SRAM is expensive, usually the SRAM is small and cannot store the whole software code. Thus, in some microcontrollers, the processor can execute instructions read directly from the flash memory, e.g., without first copying the instructions from the flash memory to the SRAM.
In microcontrollers where the processor fetches instructions directly from embedded NVM, performance can be improved by prefetching instructions. For example, where the NVM is accessed using a wide memory data bus, a pair of prefetch buffers sized accordingly with the memory data bus width can be used to decrease the average number of wait states. Prefetching improves performance particularly when the processor is executing sequential code.